Skip to content

Conversation

typotter
Copy link
Collaborator

@typotter typotter commented Mar 12, 2025

Towards FF-4076
Stacked on #240

Motivation and Context

The gen2 offline init (aka, bootstrap) requires an IConfigurationWire payload (instead of just the flag UFC json, which does not contain bandits).
Users of this bootstrap api will need to be able to generate the payload.

Description

  • gather config-wire code into a subdir
  • ConfigurationWireHelper class to fetch configs from the Eppo API endpoints and re-encode them as an IConfigurationWire instance

How has this been tested?

  • Tests

Copy link
Contributor

@aarsilv aarsilv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like everything but the names! Naming is hard...

// This SDK causes the cloud endpoint below to serve the UFC test file with bandit flags.
const BANDIT_SDK_KEY = 'this-key-serves-bandits';

describe('ConfigurationWireHelper', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

Base automatically changed from tp/ufc-in-config-wire to main March 13, 2025 14:57
@typotter typotter merged commit c2c7937 into main Mar 13, 2025
8 checks passed
@typotter typotter deleted the typo/config-wire-helper branch March 13, 2025 15:18
*/
public static build(
sdkKey: string,
opts: SdkOptions = { sdkName: 'android', sdkVersion: '4.0.0' },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there any reason we're choosing these values for defaults? They seem extremely off from being default

* Fetches configuration data from the API and build a Bootstrap Configuration (aka an `IConfigurationWire` object).
* The IConfigurationWire instance can be used to bootstrap some SDKs.
*/
public async fetchBootstrapConfiguration(): Promise<IConfigurationWire> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason we're calling it "bootstrap configuration" vs just "configuration"?

When I head "bootstrap configuration" I imagine: sdk key and set of urls to fetch configuration from

/**
* Helper class for fetching and converting configuration from the Eppo API(s).
*/
export class ConfigurationWireHelper {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks extremely similar to configuration fetcher. Is there a significant difference? can this be just a new configuration fetcher?


if (!configResponse?.flags) {
console.warn('Unable to fetch configuration, returning empty configuration');
return Promise.resolve(ConfigurationWireV1.empty());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: given the function is async, I'm pretty sure you can just do this here:

return ConfigurationWireV1.empty();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants